<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>事件处理</title>
</head>
<body>
<div id="app">
    <button v-on:click="addOne()" >add 1</button>
    <button @click="addTwo()">add 2</button>
    <button @click="count += 3">add 3</button>
    <h2>你的按钮被点击了 {{count}} 次！</h2><br><br>
    <input type="text" v-model="bookName">
    <button @click="showBook">点击显示书名</button>
</div>
<script src="vue.js"></script>
<script type="text/javascript">
    let vm = new Vue({
        el:"#app",
        data:{
            count:0,
            bookName:""
        },
        methods:{
            addOne(){
                this.count += 1;
            },
            addTwo(){
                this.count += 2;
            },
            showBook(){
                alert(this.bookName);
            }
        }
    });
</script>
</body>
</html>